﻿using Gw2Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;

namespace Gw2WvWMapControl
{
    public class MapNameConverter : IValueConverter
    {
        private static SolidColorBrush RedBrush = new SolidColorBrush(Colors.Red);
        private static SolidColorBrush BlueBrush = new SolidColorBrush(Colors.Blue);
        private static SolidColorBrush GreenBrush = new SolidColorBrush(Colors.Green);
        private static SolidColorBrush BlackBrush = new SolidColorBrush(Colors.Black);
        private static SolidColorBrush TransparentBrush = new SolidColorBrush(Colors.Transparent);

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            WvWMaps map = (WvWMaps)value;
            object retval = "";
            if (parameter.ToString() == "Letter")
            {
                switch (map)
                {
                    case WvWMaps.BlueHome:
                        retval = "B";
                        break;
                    case WvWMaps.RedHome:
                        retval = "R";
                        break;
                    case WvWMaps.GreenHome:
                        retval = "G";
                        break;
                    default:
                        retval = "N";
                        break;
                }
            }
            else if (parameter.ToString() == "Colour")
            {
                switch (map)
                {
                    case WvWMaps.BlueHome:
                        retval = BlueBrush;
                        break;
                    case WvWMaps.RedHome:
                        retval = RedBrush;
                        break;
                    case WvWMaps.GreenHome:
                        retval = GreenBrush;
                        break;
                    default:
                        retval = TransparentBrush;
                        break;
                }
            }
            return retval;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
